package com.example.jsd2205.vx.emos.config.shiro;

import org.springframework.stereotype.Component;

/**
 * 创建保存token的媒介
 * @author admin闫
 * */
@Component
public class ThreadLocalToken {

    private ThreadLocal<String> local=new ThreadLocal<>();

    /**
     * get方法用于获取token
     * @return token
     */
    public String getToken(){
        return local.get();
    }

    /**
     * set方法用于存储token
     * @param token
     */
    public void setToken(String token){
        local.set(token);
    }

    /**
     * clear用户清除token
     */
    public void clear(){
        local.remove();
    }
}
